'''
@File    :   No_support_fun_test.py
@Time    :   2024/08/15 13:31:28
@Author  :   YangLiang 
@Version :   1.0
@Contact :   yangliang@chengtech.com
@License :   (C)Copyright 2022-2025
@Desc    :   None
'''

# here put the import lib
from pickle import FALSE, TRUE
from pytest_assume.plugin import assume
 
import pytest
import time
import requests
from sympy import I
# from sympy import assuming
from commDriver.TS_CAN import *
import allure
import sys
from collections.abc import Iterable

from sqlalchemy import false
sys.dont_write_bytecode = True

import project_CAN
import Set_up

Server_NotSupportFun = [('10 02', ''),  
                        ('11 01', ''),
                        ('19 01 01', ''),
                        ('19 02 09', ''),
                        ('19 04 AC CE 17 01', ''),
                        ('19 06 AC CF 16 01', ''),
                        ('19 0A AC CF 16 01', ''),
                        ('22 F1 86', ''),
                        ('2E 34 01 01', ''),
                        ('31 01 02 03', ''),
                        ('34 00 44', ''),
                        ('36 01 01 02 03 04', ''),
                        ('36 01 01 02 03 04', ''),
                        ('37', ''),
                    ]

class Test_Not_Support_Fun(object):

    ids = [f'Request {req}' for req, resp in Server_NotSupportFun]
    @allure.severity('normal')
    @allure.story('BYD Calibration test')
    @allure.description('Test Service not support function in default session with function addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
    @pytest.mark.parametrize('req,resp', Server_NotSupportFun, ids=ids)
    def test_No_Support_Default_Fun(self,action,Driver, req, resp):      
        iStep = 1
        iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, req, resp, 1, iStep,False, 'UDSFun')

    ids = [f'Request {req}' for req, resp in Server_NotSupportFun]
    @allure.severity('normal')
    @allure.story('BYD Calibration test')
    @allure.description('Test Service not support function in programming session with function addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
    @pytest.mark.parametrize('req,resp', Server_NotSupportFun, ids=ids)
    def test_No_Support_Programming_Fun(self,action,Driver, req, resp):      
        iStep = 1
        iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, req, resp, 2, iStep,False, 'UDSFun')

    ids = [f'Request {req}' for req, resp in Server_NotSupportFun]
    @allure.severity('normal')
    @allure.story('BYD Calibration test')
    @allure.description('Test Service not support function in extended session with function addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
    @pytest.mark.parametrize('req,resp', Server_NotSupportFun, ids=ids)
    def test_No_Support_Extended_Fun(self,action,Driver, req, resp):      
        iStep = 1
        iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, req, resp, 3, iStep,False, 'UDSFun')
